#include"common.h"
int main(int argc, char **argv)
{
    int fd = -1, ret = -1;
    server_ip = NULL;
    if(argc != 1) {
        level_print(ERR, "usage: %s ./server", argv[0]);
        return FAILURE;
    }
    if((ret = rdma_init()) != SUCCESS) {
        level_print(ERR, "rdma_init failed");
        return ret;
    }
    if((ret = server_scoket_init(&fd)) != SUCCESS) {
        level_print(ERR, "server_scoket_init failed");
        goto rdma_destroy;
    }
    if((ret = get_client_qp_info(fd)) != SUCCESS) {
        level_print(ERR, "get_client_qp_info failed");
        goto rdma_destroy;
    }
    if((ret = qp_state_modify()) != SUCCESS) {
        level_print(ERR, "qp_state_modify failed");
        goto rdma_destroy;
    }
    if((ret = server_work(fd)) != SUCCESS) {
        level_print(ERR, "server_work failed");
        goto rdma_destroy;
    }
rdma_destroy:
    close(fd);
    rdma_destroy();
    return ret;
}